home *** CD-ROM | disk | FTP | other *** search
/ MacHack 2000 / MacHack 2000.toast / pc / The Hacks / Genie / Projects / Pedestal / Source / Sources / Static classes / Ped0MacToolbox.cc
Encoding:
C/C++ Source or Header  |  2000-06-24  |  2.2 KB  |  113 lines

  1. /*    =================
  2.  *    Ped0MacToolbox.cc
  3.  *    =================
  4.  */
  5.  
  6. #include "PedestalDebugging.h"
  7.  
  8. #include <AEObjects.h>
  9. #include <Dialogs.h>
  10. #include <EPPC.h>
  11. #include <Fonts.h>
  12. #include <Gestalt.h>
  13. #include <Menus.h>
  14. #include <TextEdit.h>
  15. #include <Windows.h>
  16.  
  17. #include "Ped0MacToolbox.hh"
  18.  
  19. void
  20. Ped0MacToolbox::InitToolbox()
  21. {
  22.     ::InitGraf(&qd.thePort);
  23.     ::InitFonts();
  24.     ::InitWindows();
  25.     ::InitMenus();
  26.     ::TEInit();
  27.     ::InitDialogs(NULL);
  28.     ::InitCursor();
  29.     // FlushEvents?
  30. }
  31.  
  32. void
  33. Ped0MacToolbox::InitMemory(short inMoreMasters)
  34. {
  35.     ::MaxApplZone();
  36.     for (int i = 0; i < inMoreMasters; i++)
  37.         ::MoreMasters();
  38. }
  39.  
  40. void
  41. Ped0MacToolbox::InitPPCToolbox()
  42. {
  43.     OSErr err;
  44.     long ppcAttrs;
  45.     
  46.     err = ::Gestalt(gestaltPPCToolboxAttr, &ppcAttrs);
  47.     ThrowIfOSErr_(err); // No PPC Toolbox
  48.     
  49.     if (!(ppcAttrs & gestaltPPCSupportsRealTime)) { // Not initialized
  50.         err = ::PPCInit();
  51.         ThrowIfOSErr_(err); // Couldn't initialize the PPC Toolbox
  52.     }
  53.     
  54.     if (ppcAttrs & gestaltPPCSupportsOutGoing) ;
  55.     if (ppcAttrs & gestaltPPCSupportsIncoming) ;
  56.     
  57. }
  58.  
  59. void
  60. Ped0MacToolbox::InitObjectSupportLibrary()
  61. {
  62.     OSErr err = ::AEObjectInit();
  63.     ThrowIfOSErr_(err);
  64. }
  65.  
  66. Boolean
  67. Ped0MacToolbox::HasAppleEvents()
  68. {
  69.     long gestaltValue;
  70.     return ::Gestalt(gestaltAppleEventsAttr, &gestaltValue) == noErr
  71.         && gestaltValue & (1 << gestaltAppleEventsPresent);
  72. }
  73.  
  74. Boolean
  75. Ped0MacToolbox::HasFindFolder()
  76. {
  77.     long gestaltValue;
  78.     return ::Gestalt(gestaltFindFolderAttr, &gestaltValue) == noErr
  79.         && gestaltValue & (1 << gestaltFindFolderPresent);
  80. }
  81.  
  82. Boolean
  83. Ped0MacToolbox::HasNewStandardFile()
  84. {
  85.     long gestaltValue;
  86.     return ::Gestalt(gestaltStandardFileAttr, &gestaltValue) == noErr
  87.         && gestaltValue & (1 << gestaltStandardFile58);
  88. }
  89.  
  90. Boolean
  91. Ped0MacToolbox::HasHelpManager()
  92. {
  93.     long gestaltValue;
  94.     return ::Gestalt(gestaltHelpMgrAttr, &gestaltValue) == noErr
  95.         && gestaltValue & (1 << gestaltHelpMgrPresent);
  96. }
  97.  
  98. Boolean
  99. Ped0MacToolbox::HasAliasManager()
  100. {
  101.     long gestaltValue;
  102.     return ::Gestalt(gestaltAliasMgrAttr, &gestaltValue) == noErr
  103.         && gestaltValue & (1 << gestaltAliasMgrPresent);
  104. }
  105.  
  106. Boolean
  107. Ped0MacToolbox::HasComponentManager()
  108. {
  109.     long gestaltValue;
  110.     return ::Gestalt(gestaltComponentMgr, &gestaltValue) == noErr
  111.         && gestaltValue > 0;
  112. }
  113.